package com.chen.tliaswebtest.tilasenum;

import lombok.Getter;

/**
 * @author chen
 * @version 1.0
 * @create_date 2025/7/27
 * 职位的枚举类
 */
@Getter
public enum JobEnum {
    // 班主任
    TEACHER(1, "班主任"),
    // 讲师
    TEACHER_TEACHER(2, "讲师"),
    // 学工主管
    STAFF(3, "学工主管"),
    // 教研主管
    TEACHING_STAFF(4, "教研主管"),
    // 咨询师
    CONSULTANT(5, "咨询师");

    private final Integer code;
    private final String name;

    JobEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    // 根据code获取枚举值name
    public static String getNameByCode(Integer code) {
        if (code == null) {
            return "其他";
        }
        for (JobEnum value : JobEnum.values()) {
            if ((int) value.getCode() == code) {
                return value.getName();
            }
        }
        return "其他";
    }
}
